-- card: 2888 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 2711 -- name: -- part 4 (field) -- low flags: 80 -- high flags: 0004 -- rect: left=11 top=190 right=310 bottom=386 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: warning -- part 3 (button) -- low flags: 80 -- high flags: A003 -- rect: left=318 top=274 right=298 bottom=379 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: OK ----- HyperTalk script ----- on mouseUp hide card field "warning" hide card button "ok" end mouseUp -- part 5 (field) -- low flags: 80 -- high flags: 0002 -- rect: left=12 top=31 right=184 bottom=385 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: display -- part 76 (button) -- low flags: 00 -- high flags: A000 -- rect: left=407 top=86 right=149 bottom=480 -- title width / last selected line: 0 -- icon id / first selected line: 1517 / 1517 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Import ----- HyperTalk script ----- --File Importer Button --Copyright © 1987 Stephen Michel 1027 Pomona, Albany, CA 94706 --If you like it, send me what it's worth on mouseUp global inFile global error newStack show message box at 33,296 getFile if error is not empty then exit mouseUp end if goodFile if error is not empty then exit mouseUp end if createStruct importText choose browse tool end mouseUp on newStack global inFile global error -- Creates the new stack doMenu New Stack... end newStack on getFile global inFile global error -- finds the file to import from ask "Read from what file?" if it is empty then put "true" into error else put empty into error put it into inFile end if end getFile on createStruct -- right now, this just creates a structure for a tab-delimited file global inFile global error global countFields put 0 into countFields open file inFile put "Now analyzing the structure & counting fields..." put "dummy" into it -- simply loops through the first record until it hits a return -- and adds one to countFields every time it finds a tab repeat until it is empty read from file inFile until tab add 1 to countFields if it contains return then exit repeat end if end repeat close file inFile put "There are " & countFields & " fields in the file" domenu "background" open file inFile repeat with x = 1 to countFields - 1 read from file inFile until tab ask "Please type a name for field" && x with it put it into fieldName newField fieldName end repeat read from file inFile until return ask "Please type a name for field" && countFields with it put it into fieldName newfield fieldName domenu "background" close file inFile end createStruct on importText global inFile global error global countFields open file inFile put "dummy" into it put 1 into recNum -- loops through the cards & fields until the end of file -- this usually creates one or two extra cards, but it -- was easy to code. put the seconds into startTime repeat until it is empty put "Now on record #" & recNum repeat with x = 1 to countFields -1 read from file inFile until tab -- this line removes the tab delete last character of it put it into field x end repeat read from file inFile until return put it into field countFields domenu "new card" add 1 to recNum end repeat put the seconds into stopTime close file inFile put stopTime - startTime into timeTook divide timeTook by 60 put "Done!" && recNum && "records written" && "in" && timeTook && "minutes." end importText on goodFile -- checks to make sure the file exists -- Hypercard automatically creates a new file when you -- issue the "open" command. So we read from the file -- to see if there is anything in it. -- Be sure to delete any excess files created by this. -- You can probably type in a path name to a file, if it is not -- in the same folder as HyperCard global inFile global error open file inFile read from file inFile until return if it is empty then put "That file does not exist" put "true" into error exit goodFile end if close file inFile end goodFile on newField fieldName put the number of background fields into numFields put numFields + 1 into thisField put "click where you want the field to go" wait until the mouseClick put the mouseLoc into here domenu "new field" put first item of here into right add 150 to right put second item of here into bottom add 20 to bottom put here && ","&& right && "," && bottom into thePlace set rect of background field thisField to thePlace set style of background field thisField to rectangle set name of background field thisField to fieldName end newField -- part 79 (button) -- low flags: 00 -- high flags: 8000 -- rect: left=407 top=25 right=83 bottom=479 -- title width / last selected line: 0 -- icon id / first selected line: 14767 / 14767 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: About... ----- HyperTalk script ----- on mouseUp show card field "about" end mouseUp -- part 81 (field) -- low flags: 01 -- high flags: 0004 -- rect: left=0 top=20 right=342 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 9 -- style flags: 0 -- line height: 12 -- part name: about ----- HyperTalk script ----- on mouseUp hide card field "about" end mouseUp -- part contents for card part 5 ----- text ----- 1 Frederik Pohl Heechee Rendezvous Ballantine pb 83 320 3.95 4 fic sf 3/22/85 Might round out the Heechee saga that started in Gateway. Read it on the plane to NYC. Pohl is, of course, one of the very best. Still, this novel did not move me like it should have, like Gateway did. It tells a larger story than Gateway -- that is, it is not primarily about one individual. And that is what made Gateway one of the best sf novels. -- part contents for card part 4 ----- text ----- That file does not exist Or is not in the current folder -- part contents for card part 25 ----- text ----- -- part contents for card part 26 ----- text ----- -- part contents for card part 27 ----- text ----- -- part contents for card part 29 ----- text ----- -- part contents for background part 53 ----- text ----- 1 -- part contents for background part 54 ----- text ----- Frederik -- part contents for background part 55 ----- text ----- Pohl -- part contents for background part 56 ----- text ----- Heechee Rendezvous -- part contents for background part 57 ----- text ----- Ballantine -- part contents for background part 58 ----- text ----- pb -- part contents for background part 59 ----- text ----- 83 -- part contents for background part 60 ----- text ----- 320 -- part contents for background part 61 ----- text ----- 3.95 -- part contents for background part 62 ----- text ----- 4 -- part contents for background part 63 ----- text ----- fic -- part contents for background part 65 ----- text ----- sf -- part contents for background part 66 ----- text ----- 3/22/85 -- part contents for background part 67 ----- text ----- Might round out the Heechee saga that started in Gateway. Read it on the plane to NYC. Pohl is, of course, one of the very best. Still, this novel did not move me like it should have, like Gateway did. It tells a larger story than Gateway -- that is, it is not primarily about one individual. And that is what made Gateway one of the best sf novels. -- part contents for card part 81 ----- text ----- FILE IMPORTER CLICK ANYWHERE TO RETURN Copyright © 1987 Stephen Michel 1027 Pomona, Albany, CA 94706 If you like it, please send $10. Thanx. This will read any TAB DELIMITED file into a new stack, allow you to name fields to hold the data, and do some layout of the form. It will provide a relatively complete HyperCard database that includes next, previous, and home buttons -- the rest is up to you. You will be asked first for the name of the new stack -- the usual Mac getfile stuff works here. Next it will want to know the name of the text file file. You must either type the full path name of the file, or it must be in the HyperCard folder to work. The script will then read the file, figure out how many fields are in it and ask for the name of each field. Each field name defaults to the data that is in that field in the first record of the file -- to help you remember what each field is, or if you have put the field names at the top, to make it easier. LIMITATIONS: There are many: 1) As of now, it will only read tab delimited fields, though I am working on other formats (such as mailmerge, comma delimited, SYLK, etc.). 2) All the created fields are the same size on screen. This simplified the coding, and it shouldn't be too hard to go back and adjust them. CHANGES: Aside from making it more flexible in types of files it can read, it could go faster by locking the screen, so every record doesn't have to get written. But I like to see what is going on. You can also customize this by placing the "import" button onto a background you like better -- it is self contained. Clicking "cancel" in most dialogues will NOT stop the entire operation -- I haven't done all the error trapping yet. Typing command-period will stop it, though it will leave the file open. Type "close file" followed by the file name into the message box to close the file. I have worked with files of up to 250 records, and it does take some time (about 10 minutes to read 200 or so records into a stack).